home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / sillies / iconz2 / !IconZ%a02 / 0_06 (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1994-09-18  |  22KB  |  564 lines

  1.  > IconZ2:0_05
  2.  Animated TaskManager icon
  3.  David G Jones, 1994
  4.  This software is PD, do what you will with it.
  5. $; " (Error code "; 
  6. ); ")": 
  7. prog$ = "IconZ2"
  8. vers$="0.06"
  9. date$="09 Sep 1994"
  10. command$="Desktop_IconZ2"
  11. Update%       = 5
  12. NumberFrames% = 19 + 1
  13. bl$ = 
  14. cr$ = 
  15. "Service_Reset            = &27
  16. assembly
  17.  "OS_File", 10, prog$, &FFA,, code, O%
  18. assembly
  19.  code 4096
  20.  pass% = 4 
  21. O% = code: P% = 0
  22. [ OPT pass%
  23. !                equd    start
  24. &                equd    initialize
  25.  $                equd    finalize
  26. !'                equd    serviceCall
  27. "'                equd    titleString
  28. #&                equd    helpString
  29. $$                equd    keyWords
  30.                 equd    0
  31.                 equd    0
  32.                 equd    0
  33.                 equd    0
  34. *-.titleString    equs    prog$ +bl$: align
  35. +[.helpString     equs    prog$+
  36. (9)+vers$+" ("+date$+") 
  37.  David G Jones"+bl$: align
  38. .keyWords
  39. .7.setUpdateName  equs    "IconZ2_Update" +bl$: align
  40. /)                equd    setUpdateComm
  41. 0%                equd    &00010000
  42. 1"                equd    suHelp
  43. 2"                equd    suHelp
  44. 39.newSprites     equs    "IconZ2_Sprites" + bl$: align
  45. 4*                equd    newSpritesComm
  46. 5%                equd    &00010101
  47. 6"                equd    nsHelp
  48. 7"                equd    nsHelp
  49. 87.author         equs    "IconZ2_Author" +bl$: align
  50.                 equd    0
  51. :%                equd    &000F000F
  52. ;!                equd    aHelp
  53. <!                equd    aHelp
  54. .keyWord_End    equd    0
  55. .aHelp          equs "Funky IconZ2 was created by David G Jones. If you have any comments then please get in contact:": equw &0A0D
  56. AB                equb 9: equs "160 Hazelwood Drive": equw &0A0D
  57. B9                equb 9: equs "St. Albans": equw &0A0D
  58. C=                equb 9: equs "Herts. AL4 0UZ": equw &0A0D
  59. D<                equb 9: equs "0727 - 852548" +bl$: align
  60. .suHelp         equs "IconZ2_Update controls the delay between each frame in the animation. If no delay is given then the current value is shown. All delays are in centiseconds within the range 1 - 255.": equw &0A0D
  61. GH                equs "Syntax: *IconZ2_Update [<delay>]" + bl$: align
  62. I).setUpdateComm  stmfd     r13!, {r14}
  63. J$                teq       r1, #0
  64. K%                bEQ       suPrint
  65. L&.suRead         ldrB      r2, [r0]
  66. M%                teq       r2, #32
  67. N(                addEQ     r0, r0, #1
  68. O$                bEQ       suRead
  69. P$                mov       r1, r0
  70. Q%                mov       r0, #10
  71. R0                swi       "XOS_ReadUnsigned"
  72. S(                ldmVSfd   r13!, {pc}
  73. T$                cmp       r2, #1
  74. U$                movLT     r2, #1
  75. V&                cmp       r2, #256
  76. W&                movGE     r2, #255
  77. X(                str       r2, Update
  78. Z(.suPrint        ldr       r0, Update
  79. [*                adr       r1, suValue1
  80. \$                mov       r2, #4
  81. ]4                swi       "XOS_ConvertCardinal2"
  82. ^6                movVC r2, #10: strVCB r2, [r1], #1
  83. _6                movVC r2, #13: strVCB r2, [r1], #1
  84. `6                movVC r2, #0 : strVCB r2, [r1], #1
  85. a)                adrVC     r0, suValue
  86. b*                swiVC     "XOS_Write0"
  87. c(                ldmfd     r13!, {pc}
  88. d<.suValue        equs "Current cs delay between frames: "
  89. e+.suValue1       
  90. defineMemory(8): align
  91. gX.nsHelp         equs "IconZ2_Sprites will load the spritefile filename into IconZ. "
  92.                 equs "This contains a number of sprites which are the separate frames in the animation. These should have the same dimensions and be named 'swch1', 'swch2' ...": equw &0A0D
  93. iI                equs "Syntax: *IconZ2_Sprites <filename>" +bl$: align
  94. kD.nsNotSprite    equd 0: equs "Must be a sprite file" +bl$: align
  95. lf.nsNoSwch1      equd 0: equs "Spritefile must contain at least the first frame, swch1" +bl$: align
  96. n'.newSpritesComm stmfd   r13!, {r14}
  97. o"                mov     r6, r1
  98. ; get details of file
  99. q"                mov     r1, r0
  100. r"                mov     r0, #5
  101. s&                swi     "XOS_File"
  102. t(                ldmVSfd   r13!, {pc}
  103. u"                teq     r0, #1
  104. v"                movNE   r2, r0
  105. w#                movNE   r0, #19
  106. x&                swiNE   "XOS_File"
  107. y&                ldmVSfd r13!, {pc}
  108. z+                mov     r2, r2, LSL #12
  109. {/                mov     r2, r2, LSR #12 + 8
  110. |)                mov     r3,     #&FF0
  111. })                add     r3, r3, #&009
  112. ~"                teqEQ   r2, r3
  113. +                adrNE   r0, nsNotSprite
  114. %                movNE     r3, r15
  115. 7                orrNE     r3, r3, #1 << 28; Clear V
  116. %                teqNEp    r15, r3
  117. (                ldmVSfd   r13!, {pc}
  118. .; get a new RMA block to store new sprites
  119. $                mov       r0, #6
  120. )                add       r3, r4, #16
  121. *                swi       "XOS_Module"
  122. (                ldmVSfd   r13!, {pc}
  123. +; Initialize RMA block to a sprite area
  124. *                str       r3, [r2, #0]
  125. $                mov       r0, #0
  126. *                str       r0, [r2, #4]
  127. +                str       r0, [r2, #12]
  128. %                mov       r0, #16
  129. *                str       r0, [r2, #8]
  130. '; Load sprites into new sprite area
  131. $                mov       r3, r2
  132. $                mov       r2, r1
  133. $                mov       r1, r3
  134. &                mov       r0, #256
  135. )                add       r0, r0, #10
  136. ,                swi       "XOS_SpriteOp"
  137. (                ldmVSfd   r13!, {pc}
  138. :; Ensure that there is at least swch1 sprite available
  139. $                mov     r0, #256
  140. '                add     r0, r0, #24
  141. 1                
  142. adrl("", 2, IconSpriteStart)
  143. *                swi     "XOS_SpriteOp"
  144. )                adrVS   r0, nsNoSwch1
  145. &                ldmVSfd r13!, {pc}
  146. 1; delete existing sprite storage if it exists
  147. '                ldr       r2, [r12]
  148. $                teq       r2, #0
  149. $                movNE     r0, #7
  150. *                swiNE     "XOS_Module"
  151. (                ldmVSfd   r13!, {pc}
  152. '                str       r1, [r12]
  153. K; Set up PollWord to be read so that a new icon bar icon can be created
  154. *                ldr       r0, PollMask
  155. .                bic       r0, r0, #1 << 13
  156. .                orr       r0, r0, #1 << 22
  157. *                str       r0, PollMask
  158. *; Count the number of frames available
  159. *                bL        spriteFrames
  160. /; Be quiet and quit if task not started yet
  161. $                cmp       r6, #0
  162. )                ldmMIfd   r13!, {pc}^
  163. 2; Inform user of number of frames in animation
  164. .                ldr       r0, NumberFrames
  165. (                sub       r0, r0, #1
  166. *                adr       r1, nsValue1
  167. $                mov       r2, #4
  168. 4                swi       "XOS_ConvertCardinal2"
  169. 6                movVC r2, #10: strVCB r2, [r1], #1
  170. 6                movVC r2, #13: strVCB r2, [r1], #1
  171. 6                movVC r2, #0 : strVCB r2, [r1], #1
  172. )                adrVC     r0, nsValue
  173. *                swiVC     "XOS_Write0"
  174. (                ldmfd     r13!, {pc}
  175. 6.nsValue        equs "Number of switcher frames: "
  176. +.nsValue1       
  177. defineMemory(8): align
  178. 0.nsName         
  179. equsPadWithTo("swch", 0, 8)
  180. 0.spriteFrames   stmfd   r13!, {r0 - r3, r14}
  181. "                mov     r3, #1
  182. ".Loop           mov     r0, r3
  183. *                adr     r1, nsName + 4
  184. "                mov     r2, #4
  185. 2                swi     "XOS_ConvertCardinal1"
  186. #                mov     r0, #24
  187. (                add     r0, r0, #256
  188. %                ldr     r1, [r12]
  189. &                adr     r2, nsName
  190. *                swi     "XOS_SpriteOp"
  191. &                addVC   r3, r3, #1
  192.                  bVC     Loop
  193. ,                str     r3, NumberFrames
  194. #                mov     r0, r15
  195. 5                bic     r0, r0, #1 << 28; Clear V
  196. #                teqp    r15, r0
  197. :                mov     r0, #0     ; Restart animation
  198. %                str     r0, Frame
  199. 0                ldmfd   r13!, {r0 - r3, pc}^
  200. ..serviceCall    teq     r1, #Service_Reset
  201. #                movNES  pc, r14
  202. #.serviceReset   mov     r12, #0
  203. +                str     r12, taskHandle
  204. #                movS    pc, r14
  205. .taskHandle     equd    0
  206. 6.ManagerName    equs    "Task Manager" +bl$: align
  207. .ManagerTask    equd    0
  208. '.initialize     stmfd   r13!, {r14}
  209. "                mov     r0, #0
  210. %.init_1         adr     r1, space
  211. #                mov     r2, #16
  212. 9                swi     "XTaskManager_EnumerateTasks"
  213. &                ldmVSfd r13!, {pc}
  214. "                cmp     r0, #0
  215. 1                adrLT    r0, manager_notfound
  216. J                movLT    r1, pc: orrLT r1, r1, #(1<<28): teqLTp pc, r1
  217. '                ldmVSfd  r13!, {pc}
  218. )                ldr     r2, space + 4
  219. +                adr     r3, ManagerName
  220. (.init_test      ldrB    r4, [r2], #1
  221. (                ldrB    r5, [r3], #1
  222. "                teq     r4, r5
  223. "                bNE     init_1
  224. #                cmp     r4, #32
  225. %                bGE     init_test
  226. ).init_found     ldr     r0, space + 0
  227. +                str     r0, ManagerTask
  228. '.initend        ldmfd   r13!, {pc}^
  229. U.manager_notfound equd 4: equs "Could not locate TaskManager module" + bl$: align
  230. '.finalize       stmfd   r13!, {r14}
  231. *                ldr     r0, taskHandle
  232. "                teq     r0, #0
  233. $                ldrGT   r1, TASK
  234.     -                swiGT   "XWimp_CloseDown"
  235. "                mov     r1, #0
  236. *                str     r1, taskHandle
  237. '                ldmfd   r13!, {pc}^
  238. '.wimpError     
  239. adrl("", 13, stack)
  240. $               mov     r1, #%011
  241. '               adr     r2, TaskName
  242. -               swi     "Wimp_ReportError"
  243. !               teq     r1, #1
  244. #               bEQ     wimpPoll
  245. $               b       closeDown
  246. '.startupError  
  247. adrl("", 13, stack)
  248. $               mov     r1, #%010
  249. '               adr     r2, TaskName
  250. -               swi     "Wimp_ReportError"
  251. -               
  252. adrl(" ", 3, titleString)
  253. *               swi     "OS_ExitAndDie"
  254. %.ManagerDisappear equd -2: equd 0
  255. 6.TaskName      equs     "Funky IconZ2" +bl$: align
  256.  5.PollMask      equd     %010010000001100100110011
  257. !".TASK          equs     "TASK"
  258. "?.Messages      equd &502: equd &503: equd 8: equd 3: equd 0
  259. $'.start         
  260. adrl("", 13, stack)
  261. %*.Loop          ldrB       r2, [r0], #1
  262. &)               cmp        r2, #
  263. (" ")
  264. '"               bGE        Loop
  265. (,.Loop          ldrB       r2, [r0, #-1]!
  266. ))               teq        r2, #
  267. (" ")
  268. *"               bEQ        Loop
  269. +,.Loop          ldrB       r2, [r0, #-1]!
  270. ,)               cmp        r2, #
  271. (" ")
  272. -"               bGT        Loop
  273. .$               mvn        r1, #0
  274. /:               bL         newSpritesComm              
  275. 0I               teqP       r15, #0              \ Clear off any errors
  276. 2?               mov     r0, #256                \ Start WIMP
  277. 3-               add     r0, r0, #310 - 256
  278. 4#               ldr     r1, TASK
  279. 5'               adr     r2, TaskName
  280. 6'               adr     r3, Messages
  281. 7-               swi     "XWimp_Initialise"
  282. 8'               bVS     startupError
  283. 9)               str     r1, taskHandle
  284. ;#               adr     r1, Icon
  285. <)               adr     r2, IconSprite
  286. =,               str     r2, [r1, #20 + 4]
  287. ?/               adr     r1, ManagerDisappear
  288. @-               swi     "XWimp_DeleteIcon"
  289. A)               mov     r0, #&60000000
  290. B*               adr     r1, ManagerIcon
  291. C-               swi     "XWimp_CreateIcon"
  292. E2.wimpPoll      swi     "XOS_ReadMonotonicTime"
  293. F$               bVS     wimpError
  294. G%               ldr     r2, Update
  295. H%               add     r2, r0, r2
  296. I'               ldr     r0, PollMask
  297. J$               adr     r1, space
  298. K"               mov     r3, r12
  299. L+               swi     "XWimp_PollIdle"
  300. N!               teq     r0, #0
  301. O"               bEQ     animate
  302. Q"               teq     r0, #17
  303. R"               teqNE   r0, #18
  304. S)               bEQ     receiveMessage
  305. U!               teq     r0, #6
  306. V%               bEQ     mouseclick
  307. X"               teq     r0, #13
  308. Y$               bEQ     startIcon
  309. [#               b       wimpPoll
  310. ]$.animate       ldr     r0, Frame
  311. ^%               add     r0, r0, #1
  312. _+               ldr     r1, NumberFrames
  313. `!               cmp     r0, r1
  314. a!               movGE   r0, #1
  315. b$               str     r0, Frame
  316. c-               adr     r1, IconSprite + 4
  317. d!               mov     r2, #8
  318. e1               swi     "XOS_ConvertCardinal2"
  319. f$               bVS     wimpError
  320. h)               adr     r1, UpdateIcon
  321. i/               swi     "XWimp_SetIconState"
  322. j#               bVC     wimpPoll
  323. k$               b       wimpError
  324. .Frame         equd    0
  325. .NumberFrames  equd    1
  326. o".Update        equd    Update%
  327. q#.startIcon     mov     r0, #256
  328. r&               add     r0, r0, #40
  329. s$               ldr     r1, [r12]
  330. t.               adr     r2, IconSpriteStart
  331. u)               swi     "XOS_SpriteOp"
  332. v$               adr     r6, space
  333. w!               mov     r7, #0
  334. x/               swiVC   "XWimp_ReadPixTrans"
  335. y4               bVS starticon1 ;*****************
  336. {!               mvn     r0, #0
  337. |!               mov     r1, #4
  338. }1               swi     "XOS_ReadModeVariable"
  339. ~)               mov     r3, r3, LSL r2
  340. !               mvn     r0, #0
  341. !               mov     r1, #5
  342. 1               swi     "XOS_ReadModeVariable"
  343. )               mov     r4, r4, LSL r2
  344. '               ldmia   r6, {r0, r1}
  345. %               mul     r4, r1, r4
  346. %               mul     r0, r3, r0
  347. '               ldr     r1, [r6, #8]
  348. !               bL      divide
  349. !               mov     r3, r0
  350. !               mov     r0, r4
  351. (               ldr     r1, [r6, #12]
  352. !               bL      divide
  353. "               cmp     r0, #68
  354. &               rsbLT   r1, r0, #68
  355. !               movGE   r1, #0
  356. '               str     r1, Icon + 8
  357. "               movLT   r0, #68
  358. (               str     r0, Icon + 16
  359. (               str     r3, Icon + 12
  360. /.starticon1    adr     r1, ManagerDisappear
  361. -               swi     "XWimp_DeleteIcon"
  362. $               bVS     wimpError
  363. %                ldr     r0, [r12]
  364. $                adr     r1, Icon
  365. -                str     r0, [r1, #24 + 4]
  366. *                mov     r0, #&60000000
  367. .                swi     "XWimp_CreateIcon"
  368. %                bVS     wimpError
  369. .                str     r0, UpdateIcon + 4
  370. *                ldr       r0, PollMask
  371. (                bic       r0, r0, #1
  372. .                orr       r0, r0, #1 << 13
  373. .                bic       r0, r0, #1 << 22
  374. *                str       r0, PollMask
  375. &                b         wimpPoll
  376. !.mouseclick     mov    r0, #6
  377. !                mov    r2, #1
  378. (                str    r2, [r1, #16]
  379. *                ldr    r2, ManagerTask
  380. .                swi    "XWimp_SendMessage"
  381. #                bVC    wimpPoll
  382. $                b      wimpError
  383. '.help           ldr    r0, [r1, #4]
  384. %                str    r0, helpto
  385. !                mov    r0, #1
  386. (                str    r0, [r1, #36]
  387. "                mov    r0, #17
  388. *                ldr    r2, ManagerTask
  389. .                swi    "XWimp_SendMessage"
  390. #                bVC    wimpPoll
  391. $                b      wimpError
  392. ".helpback       mov    r0, #17
  393. %                ldr    r2, helpto
  394. .                swi    "XWimp_SendMessage"
  395. #                bVC    wimpPoll
  396. $                b      wimpError
  397. .helpto         equd   0
  398. .receiveMessage
  399. (               ldr     r2, [r1, #16]
  400. H               mov r3, #&500: add r3, r3, #&02: teq r2, r3: bEQ help
  401. L                              add r3, r3, #1  : teq r2, r3: bEQ helpback
  402. 0               teq     r2, #8: bEQ closeDown
  403. /               teq     r2, #3: bEQ dataLoad
  404. !               teq     r2, #0
  405. #               bNE     wimpPoll
  406. $.closeDown     ldr     r0, [r12]
  407. !               teq     r0, #0
  408. (               bEQ     closeDown_end
  409. /               adr     r1, ManagerDisappear
  410. -               swi     "XWimp_DeleteIcon"
  411. '               adr     r0, TaskName
  412. )               adr     r1, FilterCode
  413. $               adr     r2, stack
  414. *               ldr     r3, ManagerTask
  415. 6               swi     "XFilter_RegisterPreFilter"
  416. (               bVS     closeDown_end
  417. ).Loop          ldr     r0, cdPollMask
  418. $               adr     r1, space
  419. )               adr     r3, cdPollWord
  420. '               swi     "XWimp_Poll"
  421. "               teq     r0, #13
  422.                bNE     Loop
  423. '               adr     r0, TaskName
  424. )               adr     r1, FilterCode
  425. $               adr     r2, stack
  426. *               ldr     r3, ManagerTask
  427. 8               swi     "XFilter_DeRegisterPreFilter"
  428. ).closeDown_end ldr     r0, taskHandle
  429. #               ldr     r1, TASK
  430. ,               swi     "XWimp_CloseDown"
  431. !               mov     r0, #0
  432. )               str     r0, taskHandle
  433.                
  434. -               
  435. adrl(" ", 3, titleString)
  436. *               swi     "OS_ExitAndDie"
  437. .cdPollWord    equd 0
  438. 1.cdPollMask    equd %110011100001100101110011
  439. &.space          
  440. defineMemory(256)
  441. .stack
  442. 3.UpdateIcon     equd -2: equd 0: equd 0: equd 0
  443. M.ManagerIcon    equd -7: equd 0: equd 0: equd 68: equd 68: equd &1700201A
  444. 5                
  445. equsPadWithTo("switcher", 0, 12)
  446. M.Icon           equd -7: equd 0: equd 0: equd 68: equd 68: equd &1700211A
  447. 4                equd IconSprite: equd 1: equd 12
  448. 2.IconSprite     
  449. equsPadWithTo("swch1", 0, 12)
  450. ..IconSpriteStart equs "swch1" + bl$: align
  451. 0.FilterCode     stmfd   r12!, {r0 - r1, r14}
  452. *                mov     r0, #&60000000
  453. *                str     r0, cdPollWord
  454. +                adr     r1, ManagerIcon
  455. .                swi     "XWimp_CreateIcon"
  456. 0                ldmfd   r12!, {r0 - r1, pc}^
  457. ).dataLoad       ldr     r0, [r1, #40]
  458. )                mov     r2,     #&FF0
  459. )                add     r2, r2, #&009
  460.     "                teq     r0, r2
  461. $                bNE     wimpPoll
  462. '                add     r0, r1, #44
  463. O                mvn     r1, #0      ; don't need to tell user number frames
  464. *                bL      newSpritesComm
  465. %                bVS     wimpError
  466. %                adr     r1, space
  467. (                ldr     r0, [r1, #8]
  468. )                str     r0, [r1, #12]
  469. "                mov     r0, #4
  470. )                str     r0, [r1, #16]
  471. #                mov     r0, #17
  472. (                ldr     r2, [r1, #4]
  473. /                swi     "XWimp_SendMessage"
  474. $                bVC     wimpPoll
  475. %                b       wimpError
  476. !; r0 
  477.  r1 = r0 ; r0 
  478.  r1 = r1
  479. 0.divide         stmfd   r13!, {r2 - r3, r14}
  480. "                mov     r3, r1
  481. *                cmp     r3, r0, LSR #1
  482. *.divide1        movLS   r3, r3, LSL #1
  483.  *                cmp     r3, r0, LSR #1
  484. !#                bLS     divide1
  485. ""                mov     r2, #0
  486. #".divide2        cmp     r0, r3
  487. $&                subCS   r0, r0, r3
  488. %&                adc     r2, r2, r2
  489. &*                mov     r3, r3, lsr #1
  490. '"                cmp     r3, r1
  491. (#                bHS     divide2
  492. )"                mov     r1, r0
  493. *"                mov     r0, r2
  494. +0                ldmfd   r13!, {r2 - r3, pc}^
  495. defineMemory(A%)
  496. fill(0, A%)
  497. equsPadWithTo(string$, pad%, length%)
  498.  This stores the string$. Ensuring it is pad% terminated, and altogether
  499.  takes length% bytes. (Pads all with pad%)
  500.  short$, temp$
  501. 9#short$ = 
  502. string$, length% - 1)
  503. [OPT pass%: equs short$:]
  504. ;,temp$ = 
  505. fill(pad%, length% - 
  506. (short$))
  507. fill(byte, count)
  508.  This fills in count bytes with the value in byte
  509.  loop
  510.  count = 0 
  511. D%   
  512.  "Assigning zero space here!"
  513.    =""
  514.  loop = 1 
  515.  count
  516.    [ OPT pass%
  517.          equb byte
  518.  loop
  519. [ OPT pass%
  520.       ALIGN
  521. copy(from%, to%, using%)
  522. [ OPT pass%
  523. U..copy          ldrB    using%, [from%], #1
  524. V,               strB    using%, [to%], #1
  525. W&               cmp     using%, #32
  526.                bGE     copy
  527. ]: =""
  528. adrl(c$,r%,addr%)
  529.  c%,df%,byte_lo%,byte_hi%,opcode1%,opcode2%
  530.  addr%=P% 
  531.  (pass% 
  532.  12)=0 
  533.  P%+=8:O%+=8:=0
  534. (addr%-P%)<256 
  535. error("ADRL failed: Address within range when setting R"+
  536. r%+" to "+
  537. addr%,-1)
  538. (addr%-P%)>65535 
  539. error("ADRL failed: Address outside range when setting R"+
  540. r%+" to "+
  541. addr%,-1)
  542.  c$=" " 
  543.  c$="" c$="AL"
  544. a.c%=
  545. "EQNECSCCMIPLVSVCHILSGELTGTLEALNV",c$)
  546.  c%=0 
  547. error("ADRL failed: ARM condition code not recognized when setting R"+
  548. r%+" to "+
  549. addr%,-1) 
  550.  c%=(c%-1) 
  551. df%=addr%-P%-8
  552. byte_lo%=
  553. (df%) 
  554. byte_hi%=
  555. (df%) 
  556.  &FF00
  557.  df%>=0 
  558. g3  opcode1%=(c%<<28)+&028F0000+(r%<<12)+byte_lo%
  559. hA  opcode2%=(c%<<28)+&02800C00+(r%<<16)+(r%<<12)+(byte_hi%>>8)
  560. j3  opcode1%=(c%<<28)+&024F0000+(r%<<12)+byte_lo%
  561. kA  opcode2%=(c%<<28)+&02400C00+(r%<<16)+(r%<<12)+(byte_hi%>>8)
  562. m,[OPT pass%:EQUD opcode1%:EQUD opcode2%:]
  563.  stmfd r13!, {r0 - r3}: mov r0, r0: swi &104:sub r1, r13, #16: mov r2, #8: swi "XOS_ConvertInteger2": swi "XOS_Write0": swi &105: ldmfd r13!, {r0 - r3}
  564.